package io.gitee.hefren.hhregistry.conf;

import io.gitee.hefren.hhregistry.cluster.Cluster;
import io.gitee.hefren.hhregistry.health.CheckHealth;
import io.gitee.hefren.hhregistry.health.HhCheckHealth;
import io.gitee.hefren.hhregistry.service.RegisterService;
import io.gitee.hefren.hhregistry.service.impl.HhRegisterService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 装配beans
 * @Date 2024/5/13
 * @Author lifei
 */
@Configuration
public class HhRegisterConf {

    @Bean
    public RegisterService registerService() {
        return new HhRegisterService();
    }

    @Bean(initMethod = "start", destroyMethod = "stop")
    public CheckHealth checkHealth(RegisterService registerService) {
        return new HhCheckHealth(registerService);
    }

    @Bean(initMethod = "init")
    public Cluster cluster(HhRegisterConfigProperties hhRegisterConfigProperties) {
        return new Cluster(hhRegisterConfigProperties);
    }
}
